<template>
  <div>
    <run-curd v-if="moduleInfo.type == 'curd'"></run-curd>
    <run-check v-if="moduleInfo.type == 'check'"></run-check>
    <run-tree v-if="moduleInfo.type == 'tree'"></run-tree>
  </div>
</template>

<script>
import { apiGet} from "@/api/openapi";
import RunCurd from "./curd"
import RunCheck from "./check"
import RunTree from "./tree"
import RunQuery from "./query"


export default {
  name: "RunPreview",
  components: {
    RunCurd, RunCheck, RunTree, RunQuery
  },
    data() {
        return {
            moduleCode: null,
            moduleInfo: {},
        };
    },
    created() {
        const moduleCode = this.$route.query && this.$route.query.code;
        if (!moduleCode) {
            this.$modal.msgError("参数错误");
            return;
        }
        let params = {"@table": "dev_module", code: moduleCode };
        apiGet(params).then(response => {
            this.moduleInfo = response.data;
        });
    },
    methods: {
    }
}
</script>
